home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / comm / xeno / megacd.lha / megacd / clirexx / MCDReqMan < prev    next >
Text File  |  1995-10-01  |  4KB  |  147 lines

  1. /*
  2.  *
  3.  *  MCDReqMan v1.02 ⌐ David Huckett..
  4.  *  Checks loaded CD's for pending requests from
  5.  *  when they were offline..
  6.  *   By David Huckett  16-Sep-95 3:640/800 Fidonet
  7.  *
  8.  * CLI USAGE ONLY..
  9.  *
  10. */
  11.  
  12. /*
  13.  *  Short instructions and doc..
  14.  *
  15.  *  Simply use RX MCDReqMan from the CLI once you are in the current
  16.  *  directory that this prog is in, or if you have it in your REXX:
  17.  *  assign, you can use RX MCDReqMan from any CLI window..
  18.  *
  19.  *  Alternativly just double click on the MCDReqMan Icon..
  20.  *
  21.  *  This program is best set up in a Cron Even to be executed nightly
  22.  *  and it will automatically check whatever CD('s) you have loaded and
  23.  *  fulfill any requests...
  24.  *
  25.  *  By Using NODISPLAY as an argument, you can suppress any text display
  26.  *  to the CLI window..  Used mainly if run fro a Cron..
  27.  *
  28. */
  29.  
  30. /*
  31.  *  16-Sep-95   Complete rewrite of all the OFFLINE request functions.
  32.  *
  33.  *              Everything was too slow and was to many separate things
  34.  *              for a user to remember...
  35.  *
  36.  * Been away with work and thought up new ideas..  Good to be back home.
  37.  *
  38. */
  39.  
  40. REQPATH       = 'Doors:MegaCD/Requests/'
  41. BUFFERDIR     = 'Doors:MegaCD/BUFFER/' 
  42. CDCFG         = 'Doors:MegaCD/CD.cfg'
  43. FILEDIR       = 'Doors:MegaCD/'
  44.  
  45. /*** NO FURTHER USER ADJUSTABLE VALUES BELOW HERE ***/
  46.  
  47. arg DISPLAY
  48.  
  49.     if strip(Upper(DISPLAY)) = 'NODISPLAY' then DISPLAY = 'N'
  50.     else DISPLAY = 'Y'
  51.  
  52. signal on error;signal on syntax;signal on IOERR;signal on BREAK_C
  53.  if ~show('L','rexxsupport.library') then do
  54.   if ~addlib('rexxsupport.library',0,-30,0) then do
  55.     if DISPLAY = 'Y' then say 'Support library not available.'
  56.      call error
  57.     signal Quit
  58.    end
  59. end
  60.  
  61. CALL PRAGMA('W','N')
  62.  
  63. START:
  64.  
  65.     IF DISPLAY = 'Y' then do
  66.         say '         '
  67.         tit1 = '                  +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+'
  68.         tit2 = '                  +  MegaCD Xenolink1.97 CD-Rom Door  +'
  69.         tit3 = '                  +      Offline Request Manager      +'
  70.         tit4 = '                  +          version 1.02             +'
  71.         tit5 = '                  +    by David Huckett 16-Sep-95..   +'
  72.         tit6 = '                  +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+'
  73.         say tit1;say tit2;say tit3;say tit4;say tit5;say tit6;say ''
  74.     end
  75.  
  76. if ~exists(CDcfg) then do
  77.     if DISPLAY = 'Y' then say ' You do not have a config file!'
  78.     call ERROR
  79.     end
  80. else do
  81.     Call open(cfg,CDcfg,'R')
  82.         numcd=readln(cfg)
  83.         do i=1 to numcd
  84.             lock.i=readln(cfg)
  85.             title.i=readln(cfg)
  86.             config.i=readln(cfg)
  87.             desc.i=readln(cfg)
  88.             junk=readln(cfg)
  89.             junk=readln(cfg)
  90.         if  ~Exists(lock.i) then do
  91.             title.i='Not Online'
  92.             iterate i
  93.             end
  94. if DISPLAY = 'Y' then do
  95.         say left(title.i,15)||left('LOADED',8)||left(desc.i,45)
  96.         say 'Checking for requests for 'title.i
  97. END
  98.  
  99.     CDNAME = SPACE(title.i,1,'_')
  100.     If ~EXISTS(REQPATH||CDNAME'.req') then iterate i
  101.  
  102.     else Call Open(cfile,REQPATH||CDNAME'.req',R)
  103.             do while ~EOF(cfile)
  104.             Junk = readln(cfile)
  105.             if Junk = '' then leave
  106.             FULLNAME = word(Junk,1)
  107.                         FULLPATH = word(Junk,2)
  108.                         FILENAME = word(Junk,3)
  109.     CopyToBuffer = 'Copy FROM 'FULLPATH||FILENAME' TO 'BUFFERDIR||FILENAME' QUIET'
  110.             Address command CopytoBuffer 
  111.     if exists(REQPATH||FULLNAME'.fnd') then call open(user,REQPATH||FULLNAME'.fnd',A)
  112.     else call open(user,REQPATH||FULLNAME'.fnd',W)
  113.     Call writeln(user,FILENAME)
  114.     CALL CLOSE(user)
  115.     end
  116.     CALL CLOSE(cfile)
  117.     Address command 'Delete 'REQPATH||CDNAME'.req QUIET'
  118.     end
  119.     call close(cfg)
  120. END
  121. if DISPLAY = 'Y' then do
  122. say ''
  123. say 'Finished...'
  124. say ''
  125. end
  126. call quit
  127.  
  128. BREAK_C:
  129. call close(cfg)
  130. call close(cfile)
  131. call close(user)
  132.  
  133. QUIT:
  134. Exit 0
  135.  
  136. error:
  137. a = SIGL;If DISPLAY = 'Y' then say 'Error!!!  Line # 'a;call delay 200
  138. EXIT 10
  139.  
  140. syntax:
  141. a = SIGL;If DISPLAY = 'Y' then say 'Syntax Error!!!  Line # 'a;call delay 200
  142. EXIT 10
  143.  
  144. ioerr:
  145. If DISPLAY = 'Y' then say 'I/O Error!!!';call delay 200
  146. EXIT 10
  147.